AirPrint

RSS for tag

AirPrint allows photo and document printing in your iOS apps and macOS apps without the need to download or install drivers.

Posts under AirPrint tag

26 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Crash when presenting UIPrintInteractionController on iOS 16
Starting iOS 16 seeing some crashes related to pdf printing in the crash reporter. It looks like the issue is not so frequent. Also, I'm unable to reproduce the crash. Looks like the app crashes when the print preview dialog is opening. According to crash reports, there are some crashes on different iOS 16 versions: 16.0.0, 16.0.2, and 16.0.3. Printing code: let printInfo = UIPrintInfo.printInfo() printInfo.jobName = "Printing Job Name" self.printViewController = UIPrintInteractionController.shared self.printViewController?.printInfo = printInfo self.printViewController?.printingItem = pdfURL self.printViewController?.present(from: barButtonItem, animated: true) { (controller, completed, error) in self.printViewController = nil } Stack trace: compare_key + 4 (CGPDFObject.c:134) bsearch + 68 (bsearch.c:70) CGPDFDictionaryGetUnresolvedObject + 68 (CGPDFDictionary.c:153) CGPDFDictionaryGetObject + 44 (CGPDFDictionary.c:172) CGPDFDictionaryGetDictionary + 44 (CGPDFDictionary.c:284) get_pages_dictionary + 68 (pdf-reader.c:410) pdf_reader_get_number_of_pages + 76 (pdf-reader.c:557) -[UIPrintPreviewPageFetcher fetchNumberOfItems] + 76 (UIPrintPreviewPageFetcher.m:115) -[UIPrintPreviewViewController collectionView:numberOfItemsInSection:] + 32 (UIPrintPreviewViewController.m:482) -[UICollectionViewData _updateItemCounts] + 220 (UICollectionViewData.mm:335) -[UICollectionViewData isIndexPathValid:validateItemCounts:] + 52 (UICollectionViewData.mm:348) -[UICollectionViewData validatedGlobalIndexForItemAtIndexPath:] + 36 (UICollectionViewData.mm:778) -[UICollectionView _cellForItemAtIndexPath:] + 108 (UICollectionView.m:7112) -[UICollectionView _endItemAnimationsWithInvalidationContext:tentativelyForReordering:animator:collectionViewAnimator:] + 1384 (UICollectionView.m:9357) -[UICollectionView _updateRowsAtIndexPaths:updateAction:updates:] + 396 (UICollectionView.m:9104) -[UICollectionView reloadItemsAtIndexPaths:] + 52 (UICollectionView.m:9124) -[UIPrintPreviewViewController reloadVisibleItems:] + 256 (UIPrintPreviewViewController.m:568) __63-[UIPrintPreviewViewController updatePdfURL:options:completed:]_block_invoke_2 + 44 (UIPrintPreviewViewController.m:305) __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 24 (NSOperation.m:1545) -[NSBlockOperation main] + 104 (NSOperation.m:1564) __NSOPERATION_IS_INVOKING_MAIN__ + 16 (NSOperation.m:2189) -[NSOperation start] + 708 (NSOperation.m:2206) There is full stack trace I got from the Organizer Thanks!
12
5
3.4k
Oct ’23
Cannot look at contents of file in Print Queue with Sonoma
Cannot look at contents of file in Print Queue with Sonoma Before Sonoma, after I selected print in a application, e.g., Word, I could double click on the document stored in the Print Queue and the pages would be displayed. With Sonoma, cannot see file contents?? One last thing pertaining to this Print Queue = I can't delete any of the accumulated "Completed" Jobs .. menu item to delete selected Jobs is dimmed??
0
0
559
Oct ’23
PrintKitUI random crash
Code to print self.airPrintWebView.loadHTMLString(html, baseURL: nil) self.view.add(subView:self.airPrintWebView) let formatter = self.airPrintWebView.viewPrintFormatter() //1.5" margins for the page formatter.perPageContentInsets = UIEdgeInsets(top: HALF_INCH_INSET, left: ONE_INCH_INSET, bottom: ONEHALF_INCH_INSET, right: ONE_INCH_INSET) let activityVC = UIActivityViewController(activityItems: [formatter], applicationActivities: nil) // Prevents iBook and PDF from being options activityVC.excludedActivityTypes = [.openInIBooks, .markupAsPDF] activityVC.completionWithItemsHandler = { (activity, success, items, error) in self.airPrintWebView.removeFromSuperview() if shouldRemoveSenderButton { sender.removeFromSuperview() } PredictSpringApplication.sharedInstance.psAlertBlockView?.isHidden = false } if PSUtil.isIpad() { activityVC.popoverPresentationController?.sourceView = self.airPrintWebView activityVC.popoverPresentationController?.sourceRect = sender.frame } self.present(activityVC, animated: true, completion: nil) Crash Crashed: com.apple.main-thread 0 CoreGraphics 0x107e6c CGPDFDocumentIsEncrypted + 12 1 PrintKitUI 0x586b0 -[UIPrintPreviewPageFetcher redrawQuicklookPDF:] + 104 2 PrintKitUI 0x28f4c -[UIPrintPreviewViewController updateQuicklookPDF] + 148 3 Foundation 0xa6f14 NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK + 24 4 Foundation 0x7b020 -[NSBlockOperation main] + 104 5 Foundation 0x7afb0 NSOPERATION_IS_INVOKING_MAIN + 16 6 Foundation 0x3c4d8 -[NSOperation start] + 708 7 Foundation 0x3c20c NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION + 16 8 Foundation 0x4189c __NSOQSchedule_f + 172 9 libdispatch.dylib 0x12fc4 _dispatch_block_async_invoke2 + 148 10 libdispatch.dylib 0x3eac _dispatch_client_callout + 20 11 libdispatch.dylib 0x126a4 _dispatch_main_queue_drain + 928 12 libdispatch.dylib 0x122f4 _dispatch_main_queue_callback_4CF + 44 13 CoreFoundation 0x98c28 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 16 14 CoreFoundation 0x7a560 __CFRunLoopRun + 1992 15 CoreFoundation 0x7f3ec CFRunLoopRunSpecific + 612 16 GraphicsServices 0x135c GSEventRunModal + 164 17 UIKitCore 0x39d6e8 -[UIApplication _run] + 888 18 UIKitCore 0x39d34c UIApplicationMain + 340 19 PSStore 0xbaa0 main + 2 (main.swift:2) 20 ??? 0x1b94fedec (Missing) Any body able to solve this random crash ?
7
0
1.1k
Sep ’23
After initializing the OS, the AirPrint API always prints on duplex when printing for the first time.
I want to use the AirPrint API, which is a standard OS printing function, programmatically on an iOS application to print directly to a printer by specifying single-sided printing instead of double-sided printing for the first print after the OS is initialised. 〇Verification environment ・Device: iPad 9 generation ・OS:OS16.6 ・Printer model: EPSON PX-S730 / Brother MFC-J7300CDW / Canon G5030 / EPSON PX-M791FT ※All printers used for verification support AirPrint and are capable of duplex printing. 〇Issue The duplex printing option can be specified from the program using the AirPrint API property "duplex", However, when printing is executed from the program, the specified print option "duplex printing" is not reflected in the AirPrint API. 〇Verification results Installed the developed print verification app on the device in factory default state, and executed the print process from the app to the printer. (1st time) Set the property "duplex printing" = duplex or single-sided in the AirPrint API of iOS → In both cases, printing was performed on both sides. (2nd and subsequent times) Set the property "duplex printing" = duplex or single-sided in the AirPrint API of iOS → In both cases, printing is done on one side. 〇Source Code The print verification application we developed uses the UIPrintInteractionController class in Swift to specify the printing options for duplex printing. We believe we can specify this by setting "info.duplex = UIPrintInfo.Duplex.none" in the following source code and adding it to printInfo. func buttonClick(_ sender: Any) { let printController = UIPrintInteractionController.shared let printInfo = UIPrintInfo(dictionary: nil) printInfo.jobName = "PrintJob from PrintTestApp" // color printInfo.outputType = UIPrintInfo.OutputType.general // duplex mode for the print printInfo.duplex = UIPrintInfo.Duplex.none // set the single side option printController.printInfo = printInfo // PDF printing in project folder printController.printingItem = Bundle.main.url(forResource: "sample", withExtension: "pdf")! // printer settings let printer = UIPrinter(url: URL(string: "ipps://XXXXXXX/ipp/print")!) // direct printing printController.print(to: printer, completionHandler: { controller, completed, error in guard error == nil else { return } }) }
0
0
781
Aug ’23
PrintKit crash +[_PK_OneShotXPC withTimeout:doSyncronousOneShot:]
Watchdog killed the app because PrintKit is performing XPC operations on the main thread,see the call stacks below. __dispatch_sema4_timedwait __dispatch_semaphore_wait_slow +[_PK_OneShotXPC withTimeout:doSyncronousOneShot:] __pk_mdns_resolveSynchronous -[PKPrinter(PKPrinterPrivate) resolveWithTimeout:] -[PKPrinter printerURL] -[UIPrinter _initWithPrinter:] -[UIPrinterSelectionOption setPrinter:] -[UIPrinterBrowserViewController tableView:didSelectRowAtIndexPath:] -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:isCellMultiSelect:deselectPrevious:performCustomSelectionAction:] -[UITableView _userSelectRowAtPendingSelectionIndexPath:] -[_UIAfterCACommitBlock run] -[_UIAfterCACommitQueue flush] __runAfterCACommitDeferredBlocks __cleanUpAfterCAFlushAndRunDeferredBlocks __UIApplicationFlushCATransaction __UIUpdateSequenceRun _schedulerStepScheduledMainSection _runloopSourceCallback ___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ___CFRunLoopDoSource0 ___CFRunLoopDoSources0 ___CFRunLoopRun _CFRunLoopRunSpecific _GSEventRunModal -[UIApplication _run] _UIApplicationMain main main.m:26 start
0
0
646
Jul ’23
How to print double-sided pages using UIPrintInteractionController(AirPrint) in Swift
I'm using UIPrintInteractionController(AirPrint) to print documents in my swift application. I was able to print the documents using my application, but all of them are printing in one-sided. Now i want to add a double-sided printing as an option to my application. After some research i found that it can be implement by adding info.duplex = UIPrintInfo.Duplex.longEdge to printInfo. I tried it using the below code. private var printController = UIPrintInteractionController.shared let info = UIPrintInfo.printInfo() info.duplex = UIPrintInfo.Duplex.longEdge <<<<<< info.jobName = "XXXPrint" info.orientation = .portrait printController.printInfo = info printController.print(to: printer, completionHandler: { [self] controller, completed, error in if(error != nil){ print("successfully") }else{ print("Printing error: \(error.localizedDescription)") } } But whether i set it in the code and run my application it is printing the pages by one-sided. So if some one can guide me to double-sided printing workable solution highly appreciated!!
0
0
904
Jul ’23